from abc import ABC, abstractmethod

'''
新闻提取器的工厂
'''


class NewsExtractor(ABC):
    @abstractmethod
    def extract_news(self):
        pass


class NewsExtractorFactory:
    @staticmethod
    def create_extractor(website_type):
        from new.context_product import Website1NewsExtractor, Website2NewsExtractor,Website3NewsExtractor
        if website_type == "A":
            return Website1NewsExtractor()
        elif website_type == "B":
            return Website2NewsExtractor()
        elif website_type == "C":
            return Website3NewsExtractor()
        else:
            raise ValueError("不支持的网页类型")
